<!--
 * @Author: g05047
 * @Date: 2021-06-09 15:37:23
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-07-19 15:57:53
 * @Description: file content
-->
<template>
  <div class="bill">
    <a-descriptions class="stastistic-head" title=" " layout="vertical" bordered :column="6">
      <a-descriptions-item v-for="(item,index) in statisticsList" :key="item.txt">
        <p>{{item.txt}}</p>
        <h3 v-if="item.value&&type === 'zhsdsb'&&index==0"><span style="color:#3370FF">{{item.value}}</span>/10</h3>
        <h3 v-else>{{item.value}}</h3>
      </a-descriptions-item>
    </a-descriptions>
    <slot name="search"></slot>
    <a-table v-if="type == 'qkhz'" :columns="columns" :data-source="dataSource" bordered rowKey="id" :pagination="false">
      <a-table slot="expandedRowRender" slot-scope="text" :columns="innerColumns" :show-header="false" :data-source="text.content" :pagination="false" />
    </a-table>
    <a-table v-else :columns="columns" :data-source="dataSource" bordered rowKey="id" :scroll="{ x: type != 'zhsdsb'?6000:true }" :pagination="{
                current: page,
                pageSize: pageSize,
                total: total,
                showLessItems: true,
                onChange: onPageChange,
                onShowSizeChange: onSizeChange,
            }">
      <a-badge slot="todoStatus" slot-scope="text" v-if="text" :color="text==1? 'gray' :  'gold' " :text="text==1? '待处理' :  '已锁定'" />
      <template slot="entryTime" slot-scope="text" v-if="text">{{transferDate(text,0)}}</template>
      <template slot="realDimissionDate" slot-scope="text" v-if="text">{{transferDate(text,0)}}</template>
    </a-table>
  </div>
</template>

<script>
import { transferDate } from '@/utils/util'
export default {
  name: 'bill',
  props: ['statisticsList', 'columns', 'innerColumns', 'dataSource', 'type', 'page', 'pageSize', 'total'],
  data () {
    return {};
  },
  methods: {
    transferDate,
    /**
     * @description: 分页
     * @param {*} page
     * @param {*} pageSize
     * @return {*}
     */
    onPageChange (page, pageSize) {
      this.$emit('pageChange', { page, pageSize });
    },
    onSizeChange (current, size) {
      this.$emit('sizeChange', { current, pageSize: size });
    },
  },
};
</script>

<style lang="less" scoped>
.bill {
  /deep/ .ant-card-body {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0;
  }
  .stastistic-head {
    margin-bottom: 24px;
    /deep/.ant-descriptions-view {
      table tbody .ant-descriptions-row:first-child {
        display: none;
      }
    }
  }
}
</style>
